package cz.cvut.fel.gfupan.gui.tab;

import cz.cvut.fel.gfupan.gui.MeasurePanel;
import cz.cvut.fel.gfupan.gui.component.Button;
import cz.cvut.fel.gfupan.gui.component.TextField;
import cz.cvut.fel.gfupan.gui.execution.Average;
import cz.cvut.fel.gfupan.gui.execution.Mire;
import cz.cvut.fel.gfupan.gui.util.Coordinates;
import java.util.HashMap;
import javax.swing.JComponent;

public class MireTab extends AbstractTab {

    private MeasurePanel parent;

    public MireTab(MeasurePanel parent) {
        this.parent = parent;
        tab = new HashMap<Coordinates, JComponent>();
        initComponents();
        fill();
        actualCoords = new Coordinates(0, 0);
    }

    @Override
    public void setObservers() {
        //angles
        addObserver(mireAzimutDd, mireAvgErrorDd);
        addObserver(mireMeasure1Dd, mireAvgErrorDd);
        addObserver(mireMeasure2Dd, mireAvgErrorDd);
        addObserver(mireMeasure3Dd, mireAvgErrorDd);
        addObserver(mireMeasure4Dd, mireAvgErrorDd);
        setExecutor(mireAvgErrorDd, new Mire(mireAzimutDd, new Average(
                mireMeasure1Dd, mireMeasure2Dd, mireMeasure3Dd, mireMeasure4Dd)));

        addObserver(mireAzimutMm, mireAvgErrorMm);
        addObserver(mireMeasure1Mm, mireAvgErrorMm);
        addObserver(mireMeasure2Mm, mireAvgErrorMm);
        addObserver(mireMeasure3Mm, mireAvgErrorMm);
        addObserver(mireMeasure4Mm, mireAvgErrorMm);
        setExecutor(mireAvgErrorMm, new Mire(mireAzimutMm, new Average(
                mireMeasure1Mm, mireMeasure2Mm, mireMeasure3Mm, mireMeasure4Mm)));

        addObserver(mireAzimutSs, mireAvgErrorSs);
        addObserver(mireMeasure1Ss, mireAvgErrorSs);
        addObserver(mireMeasure2Ss, mireAvgErrorSs);
        addObserver(mireMeasure3Ss, mireAvgErrorSs);
        addObserver(mireMeasure4Ss, mireAvgErrorSs);
        setExecutor(mireAvgErrorSs, new Mire(mireAzimutSs, new Average(
                mireMeasure1Ss, mireMeasure2Ss, mireMeasure3Ss, mireMeasure4Ss)));

        autoFillLoop(mireMeasure1Dd, mireMeasure2Dd, mireMeasure3Dd, mireMeasure4Dd);
        autoFillLoop(mireMeasure1Mm, mireMeasure2Mm, mireMeasure3Mm, mireMeasure4Mm);
        autoFillLoop(mireMeasure1Ss, mireMeasure2Ss, mireMeasure3Ss, mireMeasure4Ss);

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mire = new javax.swing.JPanel();
        fieldsPanel = new javax.swing.JPanel();
        mireAzimutDd = new TextField(this);
        mireAzimutMm = new TextField(this);
        mireAzimutSs = new TextField(this);
        mireMeasure1Ss = new TextField(this);
        mireMeasure1Mm = new TextField(this);
        mireMeasure1Dd = new TextField(this);
        mireMeasure2Ss = new TextField(this);
        mireMeasure2Mm = new TextField(this);
        mireMeasure2Dd = new TextField(this);
        mireMeasure3Ss = new TextField(this);
        mireMeasure3Mm = new TextField(this);
        mireMeasure3Dd = new TextField(this);
        mireMeasure4Dd = new TextField(this);
        mireMeasure4Mm = new TextField(this);
        mireMeasure4Ss = new TextField(this);
        mireAzimut = new javax.swing.JLabel();
        mireMeasure1 = new javax.swing.JLabel();
        mireMeasure2 = new javax.swing.JLabel();
        mireMeasure3 = new javax.swing.JLabel();
        mireMeasure4 = new javax.swing.JLabel();
        mireAvgErrorDd = new TextField(this);
        mireError = new javax.swing.JLabel();
        mireAvgErrorMm = new TextField(this);
        mireAvgErrorSs = new TextField(this);
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        backNextPanel = new javax.swing.JPanel();
        mireBackButton = new Button(this);
        mireNextButton = new Button(this);

        setPreferredSize(new java.awt.Dimension(531, 393));

        mire.setPreferredSize(new java.awt.Dimension(531, 393));

        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("cz/cvut/fel/gfupan/res/Bundle"); // NOI18N
        mireAzimutDd.setText(bundle.getString("MeasurePanel.mireAzimutDd.text")); // NOI18N

        mireAzimutMm.setText(bundle.getString("MeasurePanel.mireAzimutMm.text")); // NOI18N

        mireAzimutSs.setText(bundle.getString("MeasurePanel.mireAzimutSs.text")); // NOI18N

        mireMeasure1Ss.setText(bundle.getString("MeasurePanel.mireMeasure1Ss.text")); // NOI18N

        mireMeasure1Mm.setText(bundle.getString("MeasurePanel.mireMeasure1Mm.text")); // NOI18N

        mireMeasure1Dd.setText(bundle.getString("MeasurePanel.mireMeasure1Dd.text")); // NOI18N

        mireMeasure2Ss.setText(bundle.getString("MeasurePanel.mireMeasure2Ss.text")); // NOI18N

        mireMeasure2Mm.setText(bundle.getString("MeasurePanel.mireMeasure2Mm.text")); // NOI18N

        mireMeasure2Dd.setText(bundle.getString("MeasurePanel.mireMeasure2Dd.text")); // NOI18N

        mireMeasure3Ss.setText(bundle.getString("MeasurePanel.mireMeasure3Ss.text")); // NOI18N

        mireMeasure3Mm.setText(bundle.getString("MeasurePanel.mireMeasure3Mm.text")); // NOI18N

        mireMeasure3Dd.setText(bundle.getString("MeasurePanel.mireMeasure3Dd.text")); // NOI18N

        mireMeasure4Dd.setText(bundle.getString("MeasurePanel.mireMeasure4Dd.text")); // NOI18N

        mireMeasure4Mm.setText(bundle.getString("MeasurePanel.mireMeasure4Mm.text")); // NOI18N

        mireMeasure4Ss.setText(bundle.getString("MeasurePanel.mireMeasure4Ss.text")); // NOI18N

        mireAzimut.setText(bundle.getString("MeasurePanel.mireAzimut.text")); // NOI18N

        mireMeasure1.setText(bundle.getString("MeasurePanel.mireMeasure1.text")); // NOI18N

        mireMeasure2.setText(bundle.getString("MeasurePanel.mireMeasure2.text")); // NOI18N

        mireMeasure3.setText(bundle.getString("MeasurePanel.mireMeasure3.text")); // NOI18N

        mireMeasure4.setText(bundle.getString("MeasurePanel.mireMeasure4.text")); // NOI18N

        mireAvgErrorDd.setEditable(false);
        mireAvgErrorDd.setText(bundle.getString("MeasurePanel.mireAvgError.text")); // NOI18N

        mireError.setText(bundle.getString("MeasurePanel.mireError.text")); // NOI18N

        mireAvgErrorMm.setEditable(false);
        mireAvgErrorMm.setText(bundle.getString("MireTab.mireAvgErrorMm.text")); // NOI18N

        mireAvgErrorSs.setEditable(false);
        mireAvgErrorSs.setText(bundle.getString("MireTab.mireAvgErrorSs.text")); // NOI18N

        jLabel1.setText(bundle.getString("MireTab.jLabel1.text")); // NOI18N

        jLabel2.setText(bundle.getString("MireTab.jLabel2.text")); // NOI18N

        jLabel3.setText(bundle.getString("MireTab.jLabel3.text")); // NOI18N

        javax.swing.GroupLayout fieldsPanelLayout = new javax.swing.GroupLayout(fieldsPanel);
        fieldsPanel.setLayout(fieldsPanelLayout);
        fieldsPanelLayout.setHorizontalGroup(
            fieldsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(fieldsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(fieldsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(fieldsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(fieldsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(mireAzimut)
                            .addComponent(mireMeasure1))
                        .addComponent(mireMeasure2))
                    .addComponent(mireMeasure3)
                    .addComponent(mireMeasure4)
                    .addComponent(mireError))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(fieldsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(fieldsPanelLayout.createSequentialGroup()
                        .addComponent(mireMeasure3Dd, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(mireMeasure3Mm, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(mireMeasure3Ss, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(fieldsPanelLayout.createSequentialGroup()
                        .addComponent(mireMeasure1Dd, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(mireMeasure1Mm, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(mireMeasure1Ss, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(fieldsPanelLayout.createSequentialGroup()
                        .addComponent(mireMeasure2Dd, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(mireMeasure2Mm, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(mireMeasure2Ss, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(fieldsPanelLayout.createSequentialGroup()
                        .addComponent(mireAvgErrorDd, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(mireAvgErrorMm, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(mireAvgErrorSs, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(fieldsPanelLayout.createSequentialGroup()
                        .addComponent(mireMeasure4Dd, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(mireMeasure4Mm, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(mireMeasure4Ss, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(fieldsPanelLayout.createSequentialGroup()
                        .addComponent(mireAzimutDd, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(mireAzimutMm, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(mireAzimutSs, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(fieldsPanelLayout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel3)))
                .addContainerGap(274, Short.MAX_VALUE))
        );
        fieldsPanelLayout.setVerticalGroup(
            fieldsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(fieldsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(fieldsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(fieldsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(mireAzimutDd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mireAzimutMm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mireAzimut)
                    .addComponent(mireAzimutSs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(fieldsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(mireMeasure1Ss, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mireMeasure1Mm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mireMeasure1Dd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mireMeasure1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(fieldsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(mireMeasure2Ss, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mireMeasure2Mm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mireMeasure2Dd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mireMeasure2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(fieldsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(mireMeasure3Ss, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mireMeasure3Mm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mireMeasure3Dd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mireMeasure3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(fieldsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(mireMeasure4Dd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mireMeasure4Mm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mireMeasure4Ss, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mireMeasure4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(fieldsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(mireAvgErrorDd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mireError)
                    .addComponent(mireAvgErrorMm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(mireAvgErrorSs, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        mireBackButton.setText(bundle.getString("MeasurePanel.mireBackButton.text")); // NOI18N
        mireBackButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mireBackButtonActionPerformed(evt);
            }
        });

        mireNextButton.setText(bundle.getString("MeasurePanel.mireNextButton.text")); // NOI18N
        mireNextButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mireNextButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout backNextPanelLayout = new javax.swing.GroupLayout(backNextPanel);
        backNextPanel.setLayout(backNextPanelLayout);
        backNextPanelLayout.setHorizontalGroup(
            backNextPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, backNextPanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(mireBackButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(mireNextButton)
                .addContainerGap())
        );
        backNextPanelLayout.setVerticalGroup(
            backNextPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(backNextPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(backNextPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(mireNextButton)
                    .addComponent(mireBackButton))
                .addContainerGap())
        );

        javax.swing.GroupLayout mireLayout = new javax.swing.GroupLayout(mire);
        mire.setLayout(mireLayout);
        mireLayout.setHorizontalGroup(
            mireLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(fieldsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(backNextPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        mireLayout.setVerticalGroup(
            mireLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mireLayout.createSequentialGroup()
                .addComponent(fieldsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 156, Short.MAX_VALUE)
                .addComponent(backNextPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mire, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(mire, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents

    private void mireNextButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mireNextButtonActionPerformed
        parent.moveToTab(MeasurePanel.DECLINATION_TAB);
    }//GEN-LAST:event_mireNextButtonActionPerformed

    private void mireBackButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mireBackButtonActionPerformed
        parent.moveToTab(MeasurePanel.HEADER_TAB);
    }//GEN-LAST:event_mireBackButtonActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel backNextPanel;
    private javax.swing.JPanel fieldsPanel;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel mire;
    private javax.swing.JTextField mireAvgErrorDd;
    private javax.swing.JTextField mireAvgErrorMm;
    private javax.swing.JTextField mireAvgErrorSs;
    private javax.swing.JLabel mireAzimut;
    private javax.swing.JTextField mireAzimutDd;
    private javax.swing.JTextField mireAzimutMm;
    private javax.swing.JTextField mireAzimutSs;
    private javax.swing.JButton mireBackButton;
    private javax.swing.JLabel mireError;
    private javax.swing.JLabel mireMeasure1;
    private javax.swing.JTextField mireMeasure1Dd;
    private javax.swing.JTextField mireMeasure1Mm;
    private javax.swing.JTextField mireMeasure1Ss;
    private javax.swing.JLabel mireMeasure2;
    private javax.swing.JTextField mireMeasure2Dd;
    private javax.swing.JTextField mireMeasure2Mm;
    private javax.swing.JTextField mireMeasure2Ss;
    private javax.swing.JLabel mireMeasure3;
    private javax.swing.JTextField mireMeasure3Dd;
    private javax.swing.JTextField mireMeasure3Mm;
    private javax.swing.JTextField mireMeasure3Ss;
    private javax.swing.JLabel mireMeasure4;
    private javax.swing.JTextField mireMeasure4Dd;
    private javax.swing.JTextField mireMeasure4Mm;
    private javax.swing.JTextField mireMeasure4Ss;
    private javax.swing.JButton mireNextButton;
    // End of variables declaration//GEN-END:variables

    @Override
    public void clearFields() {
        clearField(mireAvgErrorDd);
        clearField(mireAvgErrorMm);
        clearField(mireAvgErrorSs);
        clearField(mireAzimutDd);
        clearField(mireAzimutMm);
        clearField(mireAzimutSs);
        clearField(mireMeasure1Dd);
        clearField(mireMeasure1Mm);
        clearField(mireMeasure1Ss);
        clearField(mireMeasure2Dd);
        clearField(mireMeasure2Mm);
        clearField(mireMeasure2Ss);
        clearField(mireMeasure3Dd);
        clearField(mireMeasure3Mm);
        clearField(mireMeasure3Ss);
        clearField(mireMeasure4Dd);
        clearField(mireMeasure4Mm);
        clearField(mireMeasure4Ss);
    }

    private void fill() {
        fillTab(0, mireAzimutDd, mireAzimutMm, mireAzimutSs);
        fillTab(1, mireMeasure1Dd, mireMeasure1Mm, mireMeasure1Ss);
        fillTab(2, mireMeasure2Dd, mireMeasure2Mm, mireMeasure2Ss);
        fillTab(3, mireMeasure3Dd, mireMeasure3Mm, mireMeasure3Ss);
        fillTab(4, mireMeasure4Dd, mireMeasure4Mm, mireMeasure4Ss);
//        fillTab(5, mireAvgErrorDd, mireAvgErrorMm, mireAvgErrorSs);
        fillTab(5, mireBackButton, mireNextButton);
    }
}
